/**
 * Fraction class
 */

public class Fraction {
	private int numerator;
	private int denominator;

	//Constructors
	public Fraction(int num, int denom) {
		numerator   = num;
		denominator = denom;
	}

	public int getNumerator() {
		return numerator;
	}

	public int getDenominator() {
		return denominator;
	}

	public void setNumerator(int num) {
		numerator = num;
	}

	public void setDenominator(int num) {
		denominator = num;
	}

	// add method
	public Fraction add(Fraction f) {
		int num   = numerator   * f.denominator + f.numerator * denominator;
		int denom = denominator * f.denominator;

		return new Fraction(num, denom);
	}

	// substract method
	public Fraction sub(Fraction f) {
		int num   = numerator   * f.denominator - f.numerator * denominator;
		int denom = denominator * f.denominator;

		return new Fraction(num, denom);
	}

}